package san.entity.article;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.Store;

import com.dao.BaseEntity;

@Entity
@Table(name = "articleitem")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Indexed(index = "article")
public class ArticleItem extends BaseEntity {
	/**
	 * 文章
	 */
	private static final long serialVersionUID = -6561198679941658381L;
	@Field(name = "title",index = Index.TOKENIZED,store=Store.YES)
	private String title;
	@Lob
	@Field(name = "content",index = Index.TOKENIZED,store=Store.YES)
	private String content;
	@Field(name = "author",index = Index.TOKENIZED,store=Store.YES)
	private String author;
	@ManyToOne(cascade = CascadeType.REFRESH, optional = false)
	@JoinColumn(name = "article_id")
	private Article article;

	public ArticleItem() {

	}

	public ArticleItem(String title,String content,String author) {
		this.title=title;
		this.content=content;
		this.author=author;
	}

	public Article getArticle() {
		return article;
	}

	public void setArticle(Article article) {
		this.article = article;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

}
